package kit.edu.lego.gruppe3;


import lejos.nxt.*;



public class StartMenue
{

	private static int index = 1;
	private static int lenght;
	
	public static void main(int i)
	{	
		lenght = i;
		ButtonListener buttonPressed = new MenueButtonListener();
		Button.ENTER.addButtonListener(buttonPressed);
		Button.ESCAPE.addButtonListener(buttonPressed);
		Button.LEFT.addButtonListener(buttonPressed);
		Button.RIGHT.addButtonListener(buttonPressed);
		
		while(true) 
			{
				LCD.drawInt(getIndex(), 2, 2);
				LCD.drawString(LegoMain.getLevel(getIndex()) , 4, 2);
				LCD.refresh();
			}
		
	}
	
	public static void setIndex(int i)
	{
		if ((index+i) > lenght) index = 1;
		else
		if ((index+i) < 1 ) index = lenght;
		else index+=i;
	}
	public static int getIndex()
	{
		return index;
	}
 
	public static void exit()
	{
		System.exit(-1);
	}
	
}
